home *** CD-ROM | disk | FTP | other *** search
/ AGA Toolkit '97 / The AGA Toolkit '97.iso / miscellaneous / science / maths / calc / lib / readme < prev    next >
Encoding:
Text File  |  1996-09-07  |  6.1 KB  |  300 lines

  1. # Copyright (c) 1994 David I. Bell and Landon Curt Noll
  2. # Permission is granted to use, distribute, or modify this source,
  3. # provided that this copyright notice remains intact.
  4.  
  5. The following calc library files are provided because they serve as 
  6. examples of how use the calc language, and because the authors thought 
  7. them to be useful!
  8.  
  9. If you write something that you think is useful, please send it to:
  10.  
  11.     dbell@canb.auug.org.au
  12.     chongo@toad.com                 {uunet,pyramid,sun}!hoptoad!chongo
  13.  
  14. By convention, a lib file only defines and/or initializes functions,
  15. objects and variables.  (The regression test is an exception.)  Also by
  16. convention, the a usage message regarding each important object and
  17. function is printed at the time of the read.
  18.  
  19. If a lib file needs to load another lib file, it should use the -once
  20. version of read:
  21.  
  22.     /* pull in needed library files */
  23.     read -once "cryrand"
  24.     read -once "curds"
  25.  
  26. This will cause the needed library files to be read once.  If these
  27. files have already been read, the read -once will act as a noop.
  28.  
  29. By convention, the global variable  lib_debug  is used to control
  30. the verbosity of debug information printed by lib files.  By default,
  31. the lib_debug has a value of 0.  If lib_debug < 0, then no debug
  32. messages are printed.  If lib_debug >= 0, then only usage message 
  33. regarding each important object are printed at the time of the read.
  34. If lib_debug == 0, then only such usage messages are printed; no
  35. other debug information is printed.
  36.  
  37. To conform to the above convention, your lib files should end with
  38. lines of the form:
  39.  
  40.     global lib_debug;
  41.     if (lib_debug >= 0) {
  42.         print "funcA(side_a, side_b, side_c) defined";
  43.         print "funcB(size, mass) defined";
  44.     }
  45.  
  46.  
  47. =-=
  48.  
  49.  
  50. bernoulli.cal
  51.  
  52.     B(n)
  53.  
  54.     Calculate the nth Bernoulli number.
  55.  
  56.  
  57. bigprime.cal
  58.  
  59.     bigprime(a, m, p) 
  60.  
  61.     A prime test, base a, on p*2^x+1 for even x>m.
  62.  
  63.  
  64. chrem.cal
  65.  
  66.     chrem(r1,m1 [,r2,m2, ...])
  67.     chrem(rlist, mlist)
  68.  
  69.     Chinese remainder theorem/problem solver.
  70.  
  71.  
  72. cryrand.cal
  73.  
  74.     shufrand()
  75.     sshufrand(seed)
  76.     rand([a, [b]])
  77.     srand(seed)
  78.     cryrand([a, [b]])
  79.     scryrand([seed, [len1, len2]])
  80.     random([a, [b]])
  81.     srandom(seed)
  82.     obj cryobj
  83.     randstate([cryobj | 0])
  84.     nxtprime(n, [val, modulus])
  85.  
  86.     Cryptographically strong pseudo-random number generator library.
  87.     
  88.  
  89. deg.cal        
  90.  
  91.     dms(deg, min, sec)
  92.     dms_add(a, b)
  93.     dms_neg(a)
  94.     dms_sub(a, b)
  95.     dms_mul(a, b)
  96.     dms_print(a)
  97.  
  98.     Calculate in degrees, minutes, and seconds.
  99.  
  100.  
  101. ellip.cal    
  102.  
  103.     factor(iN, ia, B, force)
  104.  
  105.     Attempt to factor using the elliptic functions: y^2 = x^3 + a*x + b.
  106.  
  107.  
  108. lucas.cal
  109.  
  110.     lucas(h, n)
  111.  
  112.     Perform a primality test of h*2^n-1, with 1<=h<2*n.
  113.  
  114.  
  115. lucas_chk.cal
  116.  
  117.     lucas_chk(high_n)
  118.  
  119.     Test all primes of the form h*2^n-1, with 1<=h<200 and n <= high_n.
  120.     Requires lucas.cal to be loaded.  The highest useful high_n is 1000.
  121.  
  122.  
  123. lucas_tbl.cal
  124.  
  125.     Lucasian criteria for primality tables.
  126.  
  127.  
  128. mersenne.cal
  129.  
  130.     mersenne(p)
  131.  
  132.     Perform a primality test of 2^p-1, for prime p>1.
  133.  
  134.  
  135. mod.cal    
  136.  
  137.     mod(a)
  138.     mod_print(a)
  139.     mod_one()
  140.     mod_cmp(a, b)
  141.     mod_rel(a, b)
  142.     mod_add(a, b)
  143.     mod_sub(a, b)
  144.     mod_neg(a)
  145.     mod_mul(a, b)
  146.     mod_square(a)
  147.     mod_inc(a)
  148.     mod_dec(a)
  149.     mod_inv(a)
  150.     mod_div(a, b)
  151.     mod_pow(a, b)
  152.  
  153.     Routines to handle numbers modulo a specified number.
  154.  
  155.  
  156. nextprime.cal
  157.  
  158.     nextprime(n, tries)
  159.  
  160.     Function to find the next prime (probably).
  161.  
  162.  
  163. pell.cal
  164.  
  165.     pellx(D)
  166.     pell(D)
  167.  
  168.     Solve Pell's equation; Returns the solution X to: X^2 - D * Y^2 = 1.
  169.     Type the solution to pells equation for a particular D.
  170.  
  171.  
  172. pi.cal
  173.  
  174.     qpi(epsilon)
  175.  
  176.     Calculate pi within the specified epsilon using the quartic convergence
  177.     iteration.
  178.  
  179.  
  180. pollard.cal
  181.  
  182.     factor(N, N, ai, af)
  183.  
  184.     Factor using Pollard's p-1 method.
  185.  
  186.  
  187. poly.cal    
  188.  
  189.     Calculate with polynomials of one variable.  There are many functions.
  190.     Read the documentation in the library file.
  191.  
  192.  
  193. psqrt.cal    
  194.  
  195.     psqrt(u, p)
  196.  
  197.     Calculate square roots modulo a prime
  198.  
  199.  
  200. quat.cal
  201.  
  202.     quat(a, b, c, d)
  203.     quat_print(a)
  204.     quat_norm(a)
  205.     quat_abs(a, e)
  206.     quat_conj(a)
  207.     quat_add(a, b)
  208.     quat_sub(a, b)
  209.     quat_inc(a)
  210.     quat_dec(a)
  211.     quat_neg(a)
  212.     quat_mul(a, b)
  213.     quat_div(a, b)
  214.     quat_inv(a)
  215.     quat_scale(a, b)
  216.     quat_shift(a, b)
  217.  
  218.     Calculate using quaternions of the form: a + bi + cj + dk.  In these
  219.     functions, quaternians are manipulated in the form: s + v, where
  220.     s is a scalar and v is a vector of size 3.
  221.  
  222.  
  223. randmprime.cal
  224.  
  225.     randmprime(bits, seed [,dbg])
  226.  
  227.     Find a prime of the form h*2^n-1 >= 2^bits for some given x.  The initial
  228.     search points for 'h' and 'n' are selected by a cryptographic pseudo-random
  229.     number generator.  The optional argument, dbg, if set to 1, 2 or 3
  230.     turn on various debugging print statements.
  231.  
  232.  
  233. regress.cal    
  234.  
  235.     Test the correct execution of the calculator by reading this library file.
  236.     Errors are reported with '****' mssages, or worse.  :-)
  237.  
  238.  
  239. solve.cal    
  240.  
  241.     solve(low, high, epsilon)
  242.  
  243.     Solve the equation f(x) = 0 to within the desired error value for x.
  244.     The function 'f' must be defined outside of this routine, and the low
  245.     and high values are guesses which must produce values with opposite signs.
  246.  
  247.  
  248. sumsq.cal    
  249.  
  250.     ss(p)
  251.  
  252.     Determine the unique two positive integers whose squares sum to the
  253.     specified prime.  This is always possible for all primes of the form
  254.     4N+1, and always impossible for primes of the form 4N-1.
  255.  
  256.  
  257. surd.cal    
  258.  
  259.     surd(a, b)
  260.     surd_print(a)
  261.     surd_conj(a)
  262.     surd_norm(a)
  263.     surd_value(a, xepsilon)
  264.     surd_add(a, b)
  265.     surd_sub(a, b)
  266.     surd_inc(a)
  267.     surd_dec(a)
  268.     surd_neg(a)
  269.     surd_mul(a, b)
  270.     surd_square(a)
  271.     surd_scale(a, b)
  272.     surd_shift(a, b)
  273.     surd_div(a, b)
  274.     surd_inv(a)
  275.     surd_sgn(a)
  276.     surd_cmp(a, b)
  277.     surd_rel(a, b)
  278.  
  279.     Calculate using quadratic surds of the form: a + b * sqrt(D).
  280.  
  281.  
  282. test1000.cal
  283.  
  284.     This script is used by regress.cal to test the read and use keywords.
  285.  
  286.  
  287. unitfrac.cal
  288.  
  289.     unitfrac(x)
  290.  
  291.     Represent a fraction as sum of distinct unit fractions.
  292.  
  293.  
  294. varargs.cal
  295.  
  296.     sc(a, b, ...)
  297.  
  298.     Example program to use 'varargs'.  Program to sum the cubes of all 
  299.     the specified numbers.
  300.